<?php

include("header.php");

	$svrData = array();
	$serverIP = $_GET["ip"];
        
	$query = "select id,ip,name,lastcontact,version,build_num,build_date,ini_version,amxx_version,meta_version from ".$tbl_servers." WHERE ip='".$serverIP."'";
	$result = mysql_query($query);

	$result_data = mysql_fetch_array($result);

	for($j=0;$j<10;$j++)
		$svrData[$j] = $result_data[$j];

	$diff=$time_diff * 3600;
	$last_contact=date("m-d-Y (H:i:s)",strtotime($svrData[3]) + $diff);
	
	$query_count = "SELECT COUNT(id) AS 'total' FROM exp_logged WHERE server_ip='".$serverIP."'";
	$result_count = mysql_query($query_count);
	$serverCount = mysql_fetch_array($result_count);

	print("
		<title>DoD Block Exploits - Server Details</title>
	
		<table align=\"center\" cellpadding=\"5\" cellspacing=\"0\" rules=\"rows\">
		<tr height=\"25px\">
		<td colspan=\"2\" align=\"center\" style=\"background: #20578d\">
		".$svrData[2]."
		</td>
		</tr>
	
		<tr class=\"row0\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row0'\" onClick=\"document.location='view_detections.php?ip=".$svrData[1]."'\">
		<td class=\"customtd1\" align=\"center\">IP Address:</td>
		<td class=\"customtd1\" align=\"center\">".$svrData[1]."</td>
		</tr>
					
		<tr class=\"row1\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row1'\" onClick=\"document.location='index.php'\">
		<td class=\"customtd1\" align=\"center\">Last Contact:</td>
		<td class=\"customtd1\" align=\"center\">".$last_contact."</td>
		</tr>
		
		<tr class=\"row0\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row0'\" onClick=\"document.location='view_detections.php?ip=".$svrData[1]."'\">
		<td class=\"customtd1\" align=\"center\">Detections:</td>
		<td class=\"customtd1\" align=\"center\">".$serverCount['total']."</td>
		</tr>
		
		<tr class=\"row1\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row1'\" onClick=\"document.location='view_servers.php?version=".$svrData[4]."'\">
		<td class=\"customtd1\" align=\"center\">Plugin Version:</td>
		<td class=\"customtd1\" align=\"center\">".$svrData[4]."</td>
		</tr>
		
		<tr class=\"row0\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row0'\" onClick=\"document.location='index.php'\">
		<td class=\"customtd1\" align=\"center\">Build Number:</td>
		<td class=\"customtd1\" align=\"center\">".$svrData[5]."</td>
		</tr>
		
		<tr class=\"row1\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row1'\" onClick=\"document.location='index.php'\">
		<td class=\"customtd1\" align=\"center\">Build Date:</td>
		<td class=\"customtd1\" align=\"center\">".$svrData[6]."</td>
		</tr>
		
		<tr class=\"row0\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row0'\" onClick=\"document.location='index.php'\">
		<td class=\"customtd1\" align=\"center\">INI Version:</td>
		<td class=\"customtd1\" align=\"center\">".$svrData[7]."</td>
		</tr>
		
		<tr class=\"row1\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row1'\" onClick=\"document.location='view_servers.php'\">
		<td class=\"customtd1\" align=\"center\">AMXX Version:</td>
		<td class=\"customtd1\" align=\"center\">".$svrData[8]."</td>
		</tr>
		
		<tr class=\"row0\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row0'\" onClick=\"document.location='view_servers.php'\">
		<td class=\"customtd1\" align=\"center\">MetaMod Version:</td>
		<td class=\"customtd1\" align=\"center\">".$svrData[9]."</td>
		</tr>
		
		<tr class=\"row1\" onMouseOver=\"this.className='rowhover'\" onMouseOut=\"this.className='row1'\" onClick=\"document.location='view_detections.php?ip=".$svrData[1]."'\">
		<td colspan=\"2\" class=\"customtd1\" align=\"center\">Click To View Detections</td>
		</tr>
		");
				 
	print("
		<tr>
		<td align=\"center\" colspan=\"2\" height=\"25px\" style=\"background: #20578d\">
		* displaying full server details *
		</td>
		</tr> 
		");

include("footer.php");

?>